<?php
class SearchController extends AppController {

	var $name = 'Search';
	var $helpers = array('Html', 'Form','Number');
	var $uses  = array('Product');
	
	function search(){
		$this->log($this->params);
		if( !empty($this->params['url']['t'])){
			$title = $this->params['url']['t'];
			$result = $this->Product->find('all',array('conditions' => array('Product.title =' => $title)));
			if( !empty($result) && count($result) > 0){
				$this->Session->setFlash('商品が見つかりました。');
				#$this->log($result);
				$this->set('products',$result);
			}else{
				$this->Session->setFlash('商品が見つかりませんでした');
			}
		}else{
			$this->Session->setFlash('タイトルを入力してください');
		}
	}
}
?>